package com.bistu.openlab.uofspreadsheet.namespace;

import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.Namespace;

/*
 *@author xiaoguang.gao@oracle.com
 *@version 2013-5-11 
 */
public class NamespaceDeal {
	/*xmlns:元="http://schemas.uof.org/cn/2009/metadata"
			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"*/
	
	public static Namespace YUAN = DocumentHelper.createNamespace("元", "http://schemas.uof.org/cn/2009/metadata");
	public static Namespace XSI = DocumentHelper.createNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
	public static Namespace ZI = DocumentHelper.createNamespace("字", "http://schemas.uof.org/cn/2009/wordproc");
	public static Namespace BIAO = DocumentHelper.createNamespace("表", "http://schemas.uof.org/cn/2009/spreadsheet");
	/**
	 * add namespace to element
	 * @param root
	 */
	public static void AddNamespace(Element root){
		Namespace nameSpace = DocumentHelper.createNamespace("字", "http://schemas.uof.org/cn/2009/wordproc");
		root.add(nameSpace);
		nameSpace = DocumentHelper.createNamespace("表", "http://schemas.uof.org/cn/2009/spreadsheet");
		root.add(nameSpace);
		nameSpace = DocumentHelper.createNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
		root.add(nameSpace);
	}
	/**
	 * add namespace for meta.xml
	 * @param root
	 */
	public static void MetaNamespaceAdd(Element root){
		if(root!=null){
			root.add(YUAN);
			root.add(XSI);
		}
	}
}
